devtools::install_github("jessevent/crypto", force= TRUE)
Downloading GitHub repo jessevent/crypto@HEAD
  
  
  
   checking for file ‘/tmp/RtmpCeKTv7/remotes221bcc2d5d1fd/JesseVent-crypto-2d8a610/DESCRIPTION’ ...
  
✓  checking for file ‘/tmp/RtmpCeKTv7/remotes221bcc2d5d1fd/JesseVent-crypto-2d8a610/DESCRIPTION’

  
─  preparing ‘crypto’:
   checking DESCRIPTION meta-information ...
  
   checking DESCRIPTION meta-information ... 
  
   checking DESCRIPTION meta-information ... OK
  
✓  checking DESCRIPTION meta-information

  
  
  
   
  
─  checking for LF line-endings in source and make files and shell scripts
─  checking for empty or unneeded directories

  
  
  
   
  
─  building ‘crypto_1.1.3.tar.gz’

  
   
Installing package into ‘/home/fkoeffel/R/x86_64-pc-linux-gnu-library/4.0’
(as ‘lib’ is unspecified)
* installing *source* package ‘crypto’ ...
** using staged installation
** R
** byte-compile and prepare package for lazy loading
** help
*** installing help indices
** building package indices
** testing if installed package can be loaded from temporary location
** testing if installed package can be loaded from final location
** testing if installed package keeps a record of temporary installation path
* DONE (crypto)
pacman::p_load(gganimate,gifski,png,gapminder)
pacman::p_load(tidyverse,tidyquant,FFdownload,tsibble, tibbletime, rstudioapi, data.table)
coin_list <- crypto_list(start_date_hist = "20140101", end_date_hist = "20201006", date_gap = "months")

- [2 / 82] [===>--------------------------------------------------------------------------------------------------------------------------------------------]   2% in 00:00:00 ETA: 27s
\ [3 / 82] [====>-------------------------------------------------------------------------------------------------------------------------------------------]   4% in 00:00:01 ETA:  1m
| [4 / 82] [======>-----------------------------------------------------------------------------------------------------------------------------------------]   5% in 00:00:03 ETA:  1m
/ [5 / 82] [========>---------------------------------------------------------------------------------------------------------------------------------------]   6% in 00:00:05 ETA:  1m
- [6 / 82] [==========>-------------------------------------------------------------------------------------------------------------------------------------]   7% in 00:00:06 ETA:  1m
\ [7 / 82] [===========>------------------------------------------------------------------------------------------------------------------------------------]   9% in 00:00:08 ETA:  1m
| [8 / 82] [=============>----------------------------------------------------------------------------------------------------------------------------------]  10% in 00:00:09 ETA:  1m
/ [9 / 82] [===============>--------------------------------------------------------------------------------------------------------------------------------]  11% in 00:00:10 ETA:  1m
- [10 / 82] [================>------------------------------------------------------------------------------------------------------------------------------]  12% in 00:00:12 ETA:  1m
\ [11 / 82] [==================>----------------------------------------------------------------------------------------------------------------------------]  13% in 00:00:13 ETA:  1mWarning in .Internal(gc(verbose, reset, full)) :
  closing unused connection 3 (https://coinmarketcap.com/historical/20141101/)
! Rate limit hit. Sleeping for 60 seconds.


| [12 / 82] [====================>--------------------------------------------------------------------------------------------------------------------------]  15% in 00:01:21 ETA:  8m
/ [13 / 82] [======================>------------------------------------------------------------------------------------------------------------------------]  16% in 00:01:22 ETA:  7m
- [14 / 82] [=======================>-----------------------------------------------------------------------------------------------------------------------]  17% in 00:01:23 ETA:  7m
\ [15 / 82] [=========================>---------------------------------------------------------------------------------------------------------------------]  18% in 00:01:25 ETA:  6m
| [16 / 82] [===========================>-------------------------------------------------------------------------------------------------------------------]  20% in 00:01:27 ETA:  6m
/ [17 / 82] [=============================>-----------------------------------------------------------------------------------------------------------------]  21% in 00:01:29 ETA:  6m
- [18 / 82] [==============================>----------------------------------------------------------------------------------------------------------------]  22% in 00:01:31 ETA:  5m
\ [19 / 82] [================================>--------------------------------------------------------------------------------------------------------------]  23% in 00:01:33 ETA:  5m
| [20 / 82] [==================================>------------------------------------------------------------------------------------------------------------]  24% in 00:01:35 ETA:  5m
/ [21 / 82] [====================================>----------------------------------------------------------------------------------------------------------]  26% in 00:01:36 ETA:  5m
- [22 / 82] [=====================================>---------------------------------------------------------------------------------------------------------]  27% in 00:01:38 ETA:  4mWarning in .Internal(gc(verbose, reset, full)) :
  closing unused connection 3 (https://coinmarketcap.com/historical/20151001/)
! Rate limit hit. Sleeping for 60 seconds.


\ [23 / 82] [=======================================>-------------------------------------------------------------------------------------------------------]  28% in 00:02:44 ETA:  7m
| [24 / 82] [=========================================>-----------------------------------------------------------------------------------------------------]  29% in 00:02:46 ETA:  7m
/ [25 / 82] [===========================================>---------------------------------------------------------------------------------------------------]  30% in 00:02:47 ETA:  6m
- [26 / 82] [============================================>--------------------------------------------------------------------------------------------------]  32% in 00:02:48 ETA:  6m
\ [27 / 82] [==============================================>------------------------------------------------------------------------------------------------]  33% in 00:02:50 ETA:  6m
| [28 / 82] [================================================>----------------------------------------------------------------------------------------------]  34% in 00:02:53 ETA:  6mWarning in .Internal(gc(verbose, reset, full)) :
  closing unused connection 3 (https://coinmarketcap.com/historical/20160401/)
! Rate limit hit. Sleeping for 60 seconds.

Warning in file(file, ifelse(append, "a", "w")) :
  cannot open file '/home/fkoeffel/Crypto_Assets/Crypto2/.Rproj.user/shared/notebooks/D17BDCF4-A05_CAPM/1/s/cktfjqg34vpqh/000002.metadata': No such file or directory
Error in file(file, ifelse(append, "a", "w")) : 
  cannot open the connection

/ [29 / 82] [==================================================>--------------------------------------------------------------------------------------------]  35% in 00:04:00 ETA:  7m
- [30 / 82] [===================================================>-------------------------------------------------------------------------------------------]  37% in 00:04:02 ETA:  7m
\ [31 / 82] [=====================================================>-----------------------------------------------------------------------------------------]  38% in 00:04:04 ETA:  7m
| [32 / 82] [=======================================================>---------------------------------------------------------------------------------------]  39% in 00:04:05 ETA:  6m
/ [33 / 82] [=========================================================>-------------------------------------------------------------------------------------]  40% in 00:04:08 ETA:  6m
- [34 / 82] [==========================================================>------------------------------------------------------------------------------------]  41% in 00:04:11 ETA:  6m
\ [35 / 82] [============================================================>----------------------------------------------------------------------------------]  43% in 00:04:12 ETA:  6m
| [36 / 82] [==============================================================>--------------------------------------------------------------------------------]  44% in 00:04:14 ETA:  5m
/ [37 / 82] [================================================================>------------------------------------------------------------------------------]  45% in 00:04:17 ETA:  5m
- [38 / 82] [=================================================================>-----------------------------------------------------------------------------]  46% in 00:04:19 ETA:  5m
\ [39 / 82] [===================================================================>---------------------------------------------------------------------------]  48% in 00:04:20 ETA:  5mWarning in .Internal(gc(verbose, reset, full)) :
  closing unused connection 3 (https://coinmarketcap.com/historical/20170301/)
! Rate limit hit. Sleeping for 60 seconds.


| [40 / 82] [=====================================================================>-------------------------------------------------------------------------]  49% in 00:05:27 ETA:  6m
/ [41 / 82] [=======================================================================>-----------------------------------------------------------------------]  50% in 00:05:28 ETA:  5m
- [42 / 82] [========================================================================>----------------------------------------------------------------------]  51% in 00:05:31 ETA:  5m
\ [43 / 82] [==========================================================================>--------------------------------------------------------------------]  52% in 00:05:32 ETA:  5m
| [44 / 82] [============================================================================>------------------------------------------------------------------]  54% in 00:05:34 ETA:  5m
/ [45 / 82] [=============================================================================>-----------------------------------------------------------------]  55% in 00:05:35 ETA:  5m
- [46 / 82] [===============================================================================>---------------------------------------------------------------]  56% in 00:05:37 ETA:  4m
\ [47 / 82] [=================================================================================>-------------------------------------------------------------]  57% in 00:05:38 ETA:  4m
| [48 / 82] [===================================================================================>-----------------------------------------------------------]  59% in 00:05:40 ETA:  4m
/ [49 / 82] [====================================================================================>----------------------------------------------------------]  60% in 00:05:41 ETA:  4mWarning in .Internal(gc(verbose, reset, full)) :
  closing unused connection 3 (https://coinmarketcap.com/historical/20180101/)
! Rate limit hit. Sleeping for 60 seconds.


- [50 / 82] [======================================================================================>--------------------------------------------------------]  61% in 00:06:47 ETA:  4m
\ [51 / 82] [========================================================================================>------------------------------------------------------]  62% in 00:06:49 ETA:  4m
| [52 / 82] [==========================================================================================>----------------------------------------------------]  63% in 00:06:51 ETA:  4m
/ [53 / 82] [===========================================================================================>---------------------------------------------------]  65% in 00:06:53 ETA:  4m
- [54 / 82] [=============================================================================================>-------------------------------------------------]  66% in 00:06:54 ETA:  4mWarning in .Internal(gc(verbose, reset, full)) :
  closing unused connection 3 (https://coinmarketcap.com/historical/20180601/)
! Rate limit hit. Sleeping for 60 seconds.


\ [55 / 82] [===============================================================================================>-----------------------------------------------]  67% in 00:08:01 ETA:  4m
| [56 / 82] [=================================================================================================>---------------------------------------------]  68% in 00:08:02 ETA:  4m
/ [57 / 82] [==================================================================================================>--------------------------------------------]  70% in 00:08:04 ETA:  4m
- [58 / 82] [====================================================================================================>------------------------------------------]  71% in 00:08:06 ETA:  3m
\ [59 / 82] [======================================================================================================>----------------------------------------]  72% in 00:08:09 ETA:  3m
| [60 / 82] [========================================================================================================>--------------------------------------]  73% in 00:08:10 ETA:  3m
/ [61 / 82] [=========================================================================================================>-------------------------------------]  74% in 00:08:12 ETA:  3m
- [62 / 82] [===========================================================================================================>-----------------------------------]  76% in 00:08:13 ETA:  3m
\ [63 / 82] [=============================================================================================================>---------------------------------]  77% in 00:08:15 ETA:  2m
| [64 / 82] [===============================================================================================================>-------------------------------]  78% in 00:08:16 ETA:  2mWarning in .Internal(gc(verbose, reset, full)) :
  closing unused connection 3 (https://coinmarketcap.com/historical/20190401/)
! Rate limit hit. Sleeping for 60 seconds.


/ [65 / 82] [================================================================================================================>------------------------------]  79% in 00:09:23 ETA:  2m
- [66 / 82] [==================================================================================================================>----------------------------]  80% in 00:09:24 ETA:  2m
\ [67 / 82] [====================================================================================================================>--------------------------]  82% in 00:09:26 ETA:  2m
| [68 / 82] [======================================================================================================================>------------------------]  83% in 00:09:27 ETA:  2m
/ [69 / 82] [=======================================================================================================================>-----------------------]  84% in 00:09:28 ETA:  2m
- [70 / 82] [=========================================================================================================================>---------------------]  85% in 00:09:30 ETA:  2m
\ [71 / 82] [===========================================================================================================================>-------------------]  87% in 00:09:31 ETA:  1m
| [72 / 82] [=============================================================================================================================>-----------------]  88% in 00:09:33 ETA:  1m
/ [73 / 82] [==============================================================================================================================>----------------]  89% in 00:09:34 ETA:  1m
- [74 / 82] [================================================================================================================================>--------------]  90% in 00:09:36 ETA:  1m
\ [75 / 82] [==================================================================================================================================>------------]  91% in 00:09:37 ETA:  1mWarning in .Internal(gc(verbose, reset, full)) :
  closing unused connection 3 (https://coinmarketcap.com/historical/20200301/)
! Rate limit hit. Sleeping for 60 seconds.


| [76 / 82] [====================================================================================================================================>----------]  93% in 00:10:43 ETA:  1m
/ [77 / 82] [=====================================================================================================================================>---------]  94% in 00:10:45 ETA: 42s
- [78 / 82] [=======================================================================================================================================>-------]  95% in 00:10:46 ETA: 33s
\ [79 / 82] [=========================================================================================================================================>-----]  96% in 00:10:48 ETA: 25sWarning in .Internal(gc(verbose, reset, full)) :
  closing unused connection 3 (https://coinmarketcap.com/historical/20200701/)
! Rate limit hit. Sleeping for 60 seconds.


| [80 / 82] [===========================================================================================================================================>---]  98% in 00:11:54 ETA: 18s
/ [81 / 82] [============================================================================================================================================>--]  99% in 00:11:56 ETA:  9s
- [82 / 82] [===============================================================================================================================================] 100% in 00:11:58 ETA:  0s

So, the total number of crypto currencies is 1579.

#be aware that without a limiting factor it could be a very long lasting download
coin_hist <- na.omit(crypto_history(coin_list, limit=95, start_date="20140101", end_date = "20201006", sleep = 1))
> Scraping historical crypto data


- [2 / 95] [==>-------------------------------------------------------------------------------------------------------------------------------------------]   2% in 00:00:05 ETA:  4m
\ [3 / 95] [===>------------------------------------------------------------------------------------------------------------------------------------------]   3% in 00:00:09 ETA:  5m
| [4 / 95] [=====>----------------------------------------------------------------------------------------------------------------------------------------]   4% in 00:00:13 ETA:  5m
/ [5 / 95] [======>---------------------------------------------------------------------------------------------------------------------------------------]   5% in 00:00:15 ETA:  5m
- [6 / 95] [========>-------------------------------------------------------------------------------------------------------------------------------------]   6% in 00:00:21 ETA:  5m
\ [7 / 95] [=========>------------------------------------------------------------------------------------------------------------------------------------]   7% in 00:00:26 ETA:  6m
| [8 / 95] [===========>----------------------------------------------------------------------------------------------------------------------------------]   8% in 00:00:30 ETA:  6m
/ [9 / 95] [============>---------------------------------------------------------------------------------------------------------------------------------]   9% in 00:00:35 ETA:  6m
- [10 / 95] [==============>------------------------------------------------------------------------------------------------------------------------------]  11% in 00:00:36 ETA:  5m
\ [11 / 95] [===============>-----------------------------------------------------------------------------------------------------------------------------]  12% in 00:00:41 ETA:  5mError: HTTP error 429.
Retrying in 6e+01 seconds.

| [12 / 95] [=================>---------------------------------------------------------------------------------------------------------------------------]  13% in 00:01:47 ETA: 12m
/ [13 / 95] [==================>--------------------------------------------------------------------------------------------------------------------------]  14% in 00:01:48 ETA: 11m
- [14 / 95] [====================>------------------------------------------------------------------------------------------------------------------------]  15% in 00:01:54 ETA: 11m
\ [15 / 95] [=====================>-----------------------------------------------------------------------------------------------------------------------]  16% in 00:02:02 ETA: 11m
| [16 / 95] [=======================>---------------------------------------------------------------------------------------------------------------------]  17% in 00:02:07 ETA: 10m
/ [17 / 95] [========================>--------------------------------------------------------------------------------------------------------------------]  18% in 00:02:12 ETA: 10m
- [18 / 95] [==========================>------------------------------------------------------------------------------------------------------------------]  19% in 00:02:17 ETA: 10m
\ [19 / 95] [===========================>-----------------------------------------------------------------------------------------------------------------]  20% in 00:02:22 ETA:  9m
| [20 / 95] [=============================>---------------------------------------------------------------------------------------------------------------]  21% in 00:02:24 ETA:  9m
/ [21 / 95] [==============================>--------------------------------------------------------------------------------------------------------------]  22% in 00:02:25 ETA:  9mWarning in for (i in seq_along(specs)) { :
  closing unused connection 3 (https://coinmarketcap.com/currencies/wisdom-chain/historical-data/?start=20140101&end=20201006)

- [22 / 95] [================================>------------------------------------------------------------------------------------------------------------]  23% in 00:02:28 ETA:  8m
\ [23 / 95] [=================================>-----------------------------------------------------------------------------------------------------------]  24% in 00:02:32 ETA:  8mError: HTTP error 429.
Retrying in 6e+01 seconds.

| [24 / 95] [===================================>---------------------------------------------------------------------------------------------------------]  25% in 00:03:43 ETA: 11m
/ [25 / 95] [====================================>--------------------------------------------------------------------------------------------------------]  26% in 00:03:44 ETA: 10m
- [26 / 95] [======================================>------------------------------------------------------------------------------------------------------]  27% in 00:03:49 ETA: 10m
\ [27 / 95] [=======================================>-----------------------------------------------------------------------------------------------------]  28% in 00:03:50 ETA: 10m
| [28 / 95] [=========================================>---------------------------------------------------------------------------------------------------]  29% in 00:03:57 ETA:  9m
/ [29 / 95] [==========================================>--------------------------------------------------------------------------------------------------]  31% in 00:04:01 ETA:  9m
- [30 / 95] [============================================>------------------------------------------------------------------------------------------------]  32% in 00:04:07 ETA:  9m
\ [31 / 95] [=============================================>-----------------------------------------------------------------------------------------------]  33% in 00:04:10 ETA:  9m
| [32 / 95] [==============================================>----------------------------------------------------------------------------------------------]  34% in 00:04:16 ETA:  8m
/ [33 / 95] [================================================>--------------------------------------------------------------------------------------------]  35% in 00:04:19 ETA:  8m
- [34 / 95] [=================================================>-------------------------------------------------------------------------------------------]  36% in 00:04:22 ETA:  8m
\ [35 / 95] [===================================================>-----------------------------------------------------------------------------------------]  37% in 00:04:23 ETA:  8mError: HTTP error 429.
Retrying in 6e+01 seconds.

| [36 / 95] [====================================================>----------------------------------------------------------------------------------------]  38% in 00:05:29 ETA:  9mWarning in for (i in seq_along(specs)) { :
  closing unused connection 4 (https://coinmarketcap.com/currencies/filestorm/historical-data/?start=20140101&end=20201006)
Warning in for (i in seq_along(specs)) { :
  closing unused connection 3 (https://coinmarketcap.com/currencies/anoncoin/historical-data/?start=20140101&end=20201006)

/ [37 / 95] [======================================================>--------------------------------------------------------------------------------------]  39% in 00:05:30 ETA:  9m
- [38 / 95] [=======================================================>-------------------------------------------------------------------------------------]  40% in 00:05:34 ETA:  8m
\ [39 / 95] [=========================================================>-----------------------------------------------------------------------------------]  41% in 00:05:35 ETA:  8m
| [40 / 95] [==========================================================>----------------------------------------------------------------------------------]  42% in 00:05:40 ETA:  8m
/ [41 / 95] [============================================================>--------------------------------------------------------------------------------]  43% in 00:05:41 ETA:  7m
- [42 / 95] [=============================================================>-------------------------------------------------------------------------------]  44% in 00:05:42 ETA:  7m
\ [43 / 95] [===============================================================>-----------------------------------------------------------------------------]  45% in 00:05:43 ETA:  7m
| [44 / 95] [================================================================>----------------------------------------------------------------------------]  46% in 00:05:48 ETA:  7m
/ [45 / 95] [==================================================================>--------------------------------------------------------------------------]  47% in 00:05:50 ETA:  6m
- [46 / 95] [===================================================================>-------------------------------------------------------------------------]  48% in 00:05:55 ETA:  6mError: HTTP error 429.
Retrying in 6e+01 seconds.

\ [47 / 95] [=====================================================================>-----------------------------------------------------------------------]  49% in 00:07:04 ETA:  7m
| [48 / 95] [======================================================================>----------------------------------------------------------------------]  51% in 00:07:10 ETA:  7m
/ [49 / 95] [========================================================================>--------------------------------------------------------------------]  52% in 00:07:10 ETA:  7m
- [50 / 95] [=========================================================================>-------------------------------------------------------------------]  53% in 00:07:14 ETA:  7m
\ [51 / 95] [===========================================================================>-----------------------------------------------------------------]  54% in 00:07:17 ETA:  6m
| [52 / 95] [============================================================================>----------------------------------------------------------------]  55% in 00:07:20 ETA:  6mWarning in for (i in seq_along(specs)) { :
  closing unused connection 3 (https://coinmarketcap.com/currencies/i0coin/historical-data/?start=20140101&end=20201006)

/ [53 / 95] [==============================================================================>--------------------------------------------------------------]  56% in 00:07:23 ETA:  6m
- [54 / 95] [===============================================================================>-------------------------------------------------------------]  57% in 00:07:23 ETA:  6m
\ [55 / 95] [=================================================================================>-----------------------------------------------------------]  58% in 00:07:25 ETA:  5m
| [56 / 95] [==================================================================================>----------------------------------------------------------]  59% in 00:07:30 ETA:  5mError: HTTP error 429.
Retrying in 6e+01 seconds.

/ [57 / 95] [====================================================================================>--------------------------------------------------------]  60% in 00:08:37 ETA:  6m
- [58 / 95] [=====================================================================================>-------------------------------------------------------]  61% in 00:08:40 ETA:  6m
\ [59 / 95] [=======================================================================================>-----------------------------------------------------]  62% in 00:08:45 ETA:  5m
| [60 / 95] [========================================================================================>----------------------------------------------------]  63% in 00:08:48 ETA:  5m
/ [61 / 95] [==========================================================================================>--------------------------------------------------]  64% in 00:08:51 ETA:  5m
- [62 / 95] [===========================================================================================>-------------------------------------------------]  65% in 00:08:54 ETA:  5m
\ [63 / 95] [=============================================================================================>-----------------------------------------------]  66% in 00:08:56 ETA:  5m
| [64 / 95] [==============================================================================================>----------------------------------------------]  67% in 00:09:01 ETA:  4m
/ [65 / 95] [===============================================================================================>---------------------------------------------]  68% in 00:09:02 ETA:  4m
- [66 / 95] [=================================================================================================>-------------------------------------------]  69% in 00:09:03 ETA:  4m
\ [67 / 95] [==================================================================================================>------------------------------------------]  71% in 00:09:04 ETA:  4mError: HTTP error 429.
Retrying in 6e+01 seconds.

| [68 / 95] [====================================================================================================>----------------------------------------]  72% in 00:10:13 ETA:  4m
/ [69 / 95] [=====================================================================================================>---------------------------------------]  73% in 00:10:18 ETA:  4m
- [70 / 95] [=======================================================================================================>-------------------------------------]  74% in 00:10:19 ETA:  4m
\ [71 / 95] [========================================================================================================>------------------------------------]  75% in 00:10:23 ETA:  4mWarning in for (i in seq_along(specs)) { :
  closing unused connection 4 (https://coinmarketcap.com/currencies/philosopher-stones/historical-data/?start=20140101&end=20201006)
Warning in for (i in seq_along(specs)) { :
  closing unused connection 3 (https://coinmarketcap.com/currencies/tigercoin/historical-data/?start=20140101&end=20201006)

| [72 / 95] [==========================================================================================================>----------------------------------]  76% in 00:10:25 ETA:  3m
/ [73 / 95] [===========================================================================================================>---------------------------------]  77% in 00:10:30 ETA:  3m
- [74 / 95] [=============================================================================================================>-------------------------------]  78% in 00:10:34 ETA:  3m
\ [75 / 95] [==============================================================================================================>------------------------------]  79% in 00:10:35 ETA:  3m
| [76 / 95] [================================================================================================================>----------------------------]  80% in 00:10:36 ETA:  3mError: HTTP error 429.
Retrying in 6e+01 seconds.

/ [77 / 95] [=================================================================================================================>---------------------------]  81% in 00:11:46 ETA:  3m
- [78 / 95] [===================================================================================================================>-------------------------]  82% in 00:11:47 ETA:  3m
\ [79 / 95] [====================================================================================================================>------------------------]  83% in 00:11:51 ETA:  2m
| [80 / 95] [======================================================================================================================>----------------------]  84% in 00:11:52 ETA:  2m
/ [81 / 95] [=======================================================================================================================>---------------------]  85% in 00:11:58 ETA:  2m
- [82 / 95] [=========================================================================================================================>-------------------]  86% in 00:12:01 ETA:  2m
\ [83 / 95] [==========================================================================================================================>------------------]  87% in 00:12:03 ETA:  2m
| [84 / 95] [============================================================================================================================>----------------]  88% in 00:12:07 ETA:  2m
/ [85 / 95] [=============================================================================================================================>---------------]  89% in 00:12:13 ETA:  1m
- [86 / 95] [===============================================================================================================================>-------------]  91% in 00:12:16 ETA:  1m
\ [87 / 95] [================================================================================================================================>------------]  92% in 00:12:25 ETA:  1m
| [88 / 95] [==================================================================================================================================>----------]  93% in 00:12:25 ETA:  1mError: HTTP error 429.
Retrying in 6e+01 seconds.

/ [89 / 95] [===================================================================================================================================>---------]  94% in 00:13:31 ETA:  1m
- [90 / 95] [=====================================================================================================================================>-------]  95% in 00:13:32 ETA: 45s
\ [91 / 95] [======================================================================================================================================>------]  96% in 00:13:33 ETA: 36sWarning in for (i in seq_along(specs)) { :
  closing unused connection 4 (https://coinmarketcap.com/currencies/10x-long-bitcoin-token/historical-data/?start=20140101&end=20201006)
Warning in for (i in seq_along(specs)) { :
  closing unused connection 3 (https://coinmarketcap.com/currencies/hobonickels/historical-data/?start=20140101&end=20201006)

| [92 / 95] [========================================================================================================================================>----]  97% in 00:13:34 ETA: 27s
/ [93 / 95] [=========================================================================================================================================>---]  98% in 00:13:35 ETA: 18s
- [94 / 95] [===========================================================================================================================================>-]  99% in 00:13:36 ETA:  9s
\ [95 / 95] [=============================================================================================================================================] 100% in 00:13:41 ETA:  0s
> Processing historical crypto data


- [2 / 95] [==>-------------------------------------------------------------------------------------------------------------------------------------------]   2% in 00:00:03 ETA:  3m
\ [3 / 95] [===>------------------------------------------------------------------------------------------------------------------------------------------]   3% in 00:00:06 ETA:  4m
| [4 / 95] [=====>----------------------------------------------------------------------------------------------------------------------------------------]   4% in 00:00:10 ETA:  4m
/ [5 / 95] [======>---------------------------------------------------------------------------------------------------------------------------------------]   5% in 00:00:13 ETA:  4m
- [6 / 95] [========>-------------------------------------------------------------------------------------------------------------------------------------]   6% in 00:00:13 ETA:  3m
\ [7 / 95] [=========>------------------------------------------------------------------------------------------------------------------------------------]   7% in 00:00:17 ETA:  4m
| [8 / 95] [===========>----------------------------------------------------------------------------------------------------------------------------------]   8% in 00:00:20 ETA:  4m
/ [9 / 95] [============>---------------------------------------------------------------------------------------------------------------------------------]   9% in 00:00:24 ETA:  4m
- [10 / 95] [==============>------------------------------------------------------------------------------------------------------------------------------]  11% in 00:00:28 ETA:  4m

Coin pitiscoin has missing data. Please check URL!

\ [11 / 95] [===============>-----------------------------------------------------------------------------------------------------------------------------]  12% in 00:00:28 ETA:  4m
| [12 / 95] [=================>---------------------------------------------------------------------------------------------------------------------------]  13% in 00:00:31 ETA:  4m
/ [13 / 95] [==================>--------------------------------------------------------------------------------------------------------------------------]  14% in 00:00:31 ETA:  3m

Coin worldcoin has missing data. Please check URL!

- [14 / 95] [====================>------------------------------------------------------------------------------------------------------------------------]  15% in 00:00:31 ETA:  3m
\ [15 / 95] [=====================>-----------------------------------------------------------------------------------------------------------------------]  16% in 00:00:35 ETA:  3m
| [16 / 95] [=======================>---------------------------------------------------------------------------------------------------------------------]  17% in 00:00:39 ETA:  3m
/ [17 / 95] [========================>--------------------------------------------------------------------------------------------------------------------]  18% in 00:00:43 ETA:  3m
- [18 / 95] [==========================>------------------------------------------------------------------------------------------------------------------]  19% in 00:00:46 ETA:  3m
\ [19 / 95] [===========================>-----------------------------------------------------------------------------------------------------------------]  20% in 00:00:50 ETA:  3m
| [20 / 95] [=============================>---------------------------------------------------------------------------------------------------------------]  21% in 00:00:54 ETA:  3m
/ [21 / 95] [==============================>--------------------------------------------------------------------------------------------------------------]  22% in 00:00:54 ETA:  3m
- [22 / 95] [================================>------------------------------------------------------------------------------------------------------------]  23% in 00:00:54 ETA:  3m
\ [23 / 95] [=================================>-----------------------------------------------------------------------------------------------------------]  24% in 00:00:55 ETA:  3m
| [24 / 95] [===================================>---------------------------------------------------------------------------------------------------------]  25% in 00:00:58 ETA:  3m
/ [25 / 95] [====================================>--------------------------------------------------------------------------------------------------------]  26% in 00:01:02 ETA:  3m

Coin aragon-china-token has missing data. Please check URL!

- [26 / 95] [======================================>------------------------------------------------------------------------------------------------------]  27% in 00:01:02 ETA:  3m
\ [27 / 95] [=======================================>-----------------------------------------------------------------------------------------------------]  28% in 00:01:05 ETA:  3m
| [28 / 95] [=========================================>---------------------------------------------------------------------------------------------------]  29% in 00:01:06 ETA:  3m
/ [29 / 95] [==========================================>--------------------------------------------------------------------------------------------------]  31% in 00:01:09 ETA:  3m
- [30 / 95] [============================================>------------------------------------------------------------------------------------------------]  32% in 00:01:10 ETA:  3m
\ [31 / 95] [=============================================>-----------------------------------------------------------------------------------------------]  33% in 00:01:12 ETA:  3m
| [32 / 95] [==============================================>----------------------------------------------------------------------------------------------]  34% in 00:01:13 ETA:  2m
/ [33 / 95] [================================================>--------------------------------------------------------------------------------------------]  35% in 00:01:17 ETA:  2m
- [34 / 95] [=================================================>-------------------------------------------------------------------------------------------]  36% in 00:01:18 ETA:  2m
\ [35 / 95] [===================================================>-----------------------------------------------------------------------------------------]  37% in 00:01:19 ETA:  2m
| [36 / 95] [====================================================>----------------------------------------------------------------------------------------]  38% in 00:01:19 ETA:  2m

Coin filestorm has missing data. Please check URL!

/ [37 / 95] [======================================================>--------------------------------------------------------------------------------------]  39% in 00:01:19 ETA:  2m
- [38 / 95] [=======================================================>-------------------------------------------------------------------------------------]  40% in 00:01:20 ETA:  2m
\ [39 / 95] [=========================================================>-----------------------------------------------------------------------------------]  41% in 00:01:23 ETA:  2m

Coin sxc has missing data. Please check URL!

| [40 / 95] [==========================================================>----------------------------------------------------------------------------------]  42% in 00:01:23 ETA:  2m
/ [41 / 95] [============================================================>--------------------------------------------------------------------------------]  43% in 00:01:26 ETA:  2m
- [42 / 95] [=============================================================>-------------------------------------------------------------------------------]  44% in 00:01:26 ETA:  2m

Coin mincoin has missing data. Please check URL!

\ [43 / 95] [===============================================================>-----------------------------------------------------------------------------]  45% in 00:01:26 ETA:  2m
| [44 / 95] [================================================================>----------------------------------------------------------------------------]  46% in 00:01:27 ETA:  2m
/ [45 / 95] [==================================================================>--------------------------------------------------------------------------]  47% in 00:01:31 ETA:  2m
- [46 / 95] [===================================================================>-------------------------------------------------------------------------]  48% in 00:01:31 ETA:  2m
\ [47 / 95] [=====================================================================>-----------------------------------------------------------------------]  49% in 00:01:33 ETA:  2m
| [48 / 95] [======================================================================>----------------------------------------------------------------------]  51% in 00:01:35 ETA:  2m
/ [49 / 95] [========================================================================>--------------------------------------------------------------------]  52% in 00:01:37 ETA:  2m

Coin doge-tron-classic has missing data. Please check URL!

- [50 / 95] [=========================================================================>-------------------------------------------------------------------]  53% in 00:01:37 ETA:  1m
\ [51 / 95] [===========================================================================>-----------------------------------------------------------------]  54% in 00:01:41 ETA:  1m
| [52 / 95] [============================================================================>----------------------------------------------------------------]  55% in 00:01:42 ETA:  1m
/ [53 / 95] [==============================================================================>--------------------------------------------------------------]  56% in 00:01:43 ETA:  1m
- [54 / 95] [===============================================================================>-------------------------------------------------------------]  57% in 00:01:44 ETA:  1m
\ [55 / 95] [=================================================================================>-----------------------------------------------------------]  58% in 00:01:44 ETA:  1m
| [56 / 95] [==================================================================================>----------------------------------------------------------]  59% in 00:01:44 ETA:  1m
/ [57 / 95] [====================================================================================>--------------------------------------------------------]  60% in 00:01:48 ETA:  1m
- [58 / 95] [=====================================================================================>-------------------------------------------------------]  61% in 00:01:49 ETA:  1m
\ [59 / 95] [=======================================================================================>-----------------------------------------------------]  62% in 00:01:50 ETA:  1m
| [60 / 95] [========================================================================================>----------------------------------------------------]  63% in 00:01:53 ETA:  1m
/ [61 / 95] [==========================================================================================>--------------------------------------------------]  64% in 00:01:54 ETA:  1m
- [62 / 95] [===========================================================================================>-------------------------------------------------]  65% in 00:01:55 ETA:  1m
\ [63 / 95] [=============================================================================================>-----------------------------------------------]  66% in 00:01:55 ETA:  1m

Coin betacoin has missing data. Please check URL!

| [64 / 95] [==============================================================================================>----------------------------------------------]  67% in 00:01:55 ETA:  1m
/ [65 / 95] [===============================================================================================>---------------------------------------------]  68% in 00:01:59 ETA:  1m
- [66 / 95] [=================================================================================================>-------------------------------------------]  69% in 00:01:59 ETA:  1m

Coin btecoin has missing data. Please check URL!

\ [67 / 95] [==================================================================================================>------------------------------------------]  71% in 00:01:59 ETA: 50s

Coin linkey has missing data. Please check URL!

| [68 / 95] [====================================================================================================>----------------------------------------]  72% in 00:01:59 ETA: 47s
/ [69 / 95] [=====================================================================================================>---------------------------------------]  73% in 00:02:00 ETA: 45s
- [70 / 95] [=======================================================================================================>-------------------------------------]  74% in 00:02:04 ETA: 44s

Coin gamelife has missing data. Please check URL!

\ [71 / 95] [========================================================================================================>------------------------------------]  75% in 00:02:04 ETA: 42s
| [72 / 95] [==========================================================================================================>----------------------------------]  76% in 00:02:07 ETA: 41s
/ [73 / 95] [===========================================================================================================>---------------------------------]  77% in 00:02:08 ETA: 39s
- [74 / 95] [=============================================================================================================>-------------------------------]  78% in 00:02:09 ETA: 37s
\ [75 / 95] [==============================================================================================================>------------------------------]  79% in 00:02:12 ETA: 35s

Coin orb-v2 has missing data. Please check URL!

| [76 / 95] [================================================================================================================>----------------------------]  80% in 00:02:12 ETA: 33s

Coin argentum has missing data. Please check URL!

/ [77 / 95] [=================================================================================================================>---------------------------]  81% in 00:02:12 ETA: 31s
- [78 / 95] [===================================================================================================================>-------------------------]  82% in 00:02:14 ETA: 29s
\ [79 / 95] [====================================================================================================================>------------------------]  83% in 00:02:14 ETA: 27s

Coin joulecoin has missing data. Please check URL!

| [80 / 95] [======================================================================================================================>----------------------]  84% in 00:02:14 ETA: 25s
/ [81 / 95] [=======================================================================================================================>---------------------]  85% in 00:02:15 ETA: 23s
- [82 / 95] [=========================================================================================================================>-------------------]  86% in 00:02:18 ETA: 22s
\ [83 / 95] [==========================================================================================================================>------------------]  87% in 00:02:19 ETA: 20s

Coin cr-coin has missing data. Please check URL!

| [84 / 95] [============================================================================================================================>----------------]  88% in 00:02:19 ETA: 18s
/ [85 / 95] [=============================================================================================================================>---------------]  89% in 00:02:20 ETA: 17s
- [86 / 95] [===============================================================================================================================>-------------]  91% in 00:02:23 ETA: 15s
\ [87 / 95] [================================================================================================================================>------------]  92% in 00:02:24 ETA: 13s
| [88 / 95] [==================================================================================================================================>----------]  93% in 00:02:28 ETA: 12s
/ [89 / 95] [===================================================================================================================================>---------]  94% in 00:02:28 ETA: 10s

Coin 10x-long-bitcoin-token has missing data. Please check URL!

- [90 / 95] [=====================================================================================================================================>-------]  95% in 00:02:28 ETA:  8s

Coin moon has missing data. Please check URL!

\ [91 / 95] [======================================================================================================================================>------]  96% in 00:02:28 ETA:  7s

Coin portion has missing data. Please check URL!

| [92 / 95] [========================================================================================================================================>----]  97% in 00:02:28 ETA:  5s
/ [93 / 95] [=========================================================================================================================================>---]  98% in 00:02:28 ETA:  3s

Coin securecoin has missing data. Please check URL!

- [94 / 95] [===========================================================================================================================================>-]  99% in 00:02:28 ETA:  2s
\ [95 / 95] [=============================================================================================================================================] 100% in 00:02:28 ETA:  0s
coin_hist
#prepared coin history
prep_coin_hist <- coin_hist %>%
  select(date, symbol, name, open, close, high, low, volume, market, close_ratio, spread) %>%
  filter(between(date, as.Date("2013-01-01"), as.Date("2020-10-06"))) %>%
  group_by(symbol)

#2013
coin_hist_2013 <- coin_hist %>%
  select(date, symbol, name, open, close, high, low, volume, market, close_ratio, spread) %>%
  filter(between(date, as.Date("2013-01-01"), as.Date("2013-12-31"))) %>%
  group_by(symbol) # For some reason it downloads the variables, but without any observation

#2014
coin_hist_2014 <- coin_hist %>%
  select(date, symbol, name, open, close, high, low, volume, market, close_ratio, spread) %>%
  filter(between(date, as.Date("2014-01-01"), as.Date("2014-12-31"))) %>%
  group_by(symbol)

#2015
coin_hist_2015 <- coin_hist %>%
     select(date, symbol, name, open, close, high, low, volume, market, close_ratio, spread) %>%
     filter(between(date, as.Date("2015-01-01"), as.Date("2015-12-31"))) %>%
  group_by(symbol)

#2016
coin_hist_2016 <- coin_hist %>%
     select(date, symbol, name, open, close, high, low, volume, market, close_ratio, spread) %>%
     filter(between(date, as.Date("2016-01-01"), as.Date("2016-12-31"))) %>%
  group_by(symbol)

#2017
coin_hist_2017 <- coin_hist %>%
     select(date, symbol, name, open, close, high, low, volume, market, close_ratio, spread) %>%
     filter(between(date, as.Date("2017-01-01"), as.Date("2017-12-31"))) %>%
  group_by(symbol)

#2018
coin_hist_2018 <- coin_hist %>%
     select(date, symbol, name, open, close, high, low, volume, market, close_ratio, spread) %>%
     filter(between(date, as.Date("2018-01-01"), as.Date("2018-12-31"))) %>%
  group_by(symbol)

#2019
coin_hist_2019 <- coin_hist %>%
     select(date, symbol, name, open, close, high, low, volume, market, close_ratio, spread) %>%
     filter(between(date, as.Date("2019-01-01"), as.Date("2019-12-31"))) %>%
  group_by(symbol)

#2020 until 6th October
coin_hist_2020 <- coin_hist %>%
     select(date, symbol, name, open, close, high, low, volume, market, close_ratio, spread) %>%
     filter(between(date, as.Date("2020-01-01"), as.Date("2020-10-06"))) %>%
  group_by(symbol)
return_all <- stats::aggregate(x = prep_coin_hist[,3:4], list(prep_coin_hist$name), mean)
argument is not numeric or logical: returning NAargument is not numeric or logical: returning NAargument is not numeric or logical: returning NAargument is not numeric or logical: returning NAargument is not numeric or logical: returning NAargument is not numeric or logical: returning NAargument is not numeric or logical: returning NAargument is not numeric or logical: returning NAargument is not numeric or logical: returning NAargument is not numeric or logical: returning NAargument is not numeric or logical: returning NAargument is not numeric or logical: returning NAargument is not numeric or logical: returning NAargument is not numeric or logical: returning NAargument is not numeric or logical: returning NAargument is not numeric or logical: returning NAargument is not numeric or logical: returning NAargument is not numeric or logical: returning NAargument is not numeric or logical: returning NAargument is not numeric or logical: returning NAargument is not numeric or logical: returning NAargument is not numeric or logical: returning NAargument is not numeric or logical: returning NAargument is not numeric or logical: returning NAargument is not numeric or logical: returning NAargument is not numeric or logical: returning NAargument is not numeric or logical: returning NAargument is not numeric or logical: returning NAargument is not numeric or logical: returning NAargument is not numeric or logical: returning NAargument is not numeric or logical: returning NAargument is not numeric or logical: returning NAargument is not numeric or logical: returning NAargument is not numeric or logical: returning NAargument is not numeric or logical: returning NAargument is not numeric or logical: returning NAargument is not numeric or logical: returning NAargument is not numeric or logical: returning NAargument is not numeric or logical: returning NAargument is not numeric or logical: returning NAargument is not numeric or logical: returning NAargument is not numeric or logical: returning NAargument is not numeric or logical: returning NAargument is not numeric or logical: returning NAargument is not numeric or logical: returning NAargument is not numeric or logical: returning NAargument is not numeric or logical: returning NAargument is not numeric or logical: returning NAargument is not numeric or logical: returning NAargument is not numeric or logical: returning NAargument is not numeric or logical: returning NAargument is not numeric or logical: returning NAargument is not numeric or logical: returning NAargument is not numeric or logical: returning NAargument is not numeric or logical: returning NAargument is not numeric or logical: returning NAargument is not numeric or logical: returning NAargument is not numeric or logical: returning NAargument is not numeric or logical: returning NAargument is not numeric or logical: returning NAargument is not numeric or logical: returning NAargument is not numeric or logical: returning NAargument is not numeric or logical: returning NAargument is not numeric or logical: returning NAargument is not numeric or logical: returning NAargument is not numeric or logical: returning NAargument is not numeric or logical: returning NAargument is not numeric or logical: returning NAargument is not numeric or logical: returning NAargument is not numeric or logical: returning NAargument is not numeric or logical: returning NAargument is not numeric or logical: returning NAargument is not numeric or logical: returning NAargument is not numeric or logical: returning NAargument is not numeric or logical: returning NAargument is not numeric or logical: returning NA
risk_all <- stats::aggregate(x = prep_coin_hist[,3:4], list(prep_coin_hist$name),sd)
NAs introduced by coercionNAs introduced by coercionNAs introduced by coercionNAs introduced by coercionNAs introduced by coercionNAs introduced by coercionNAs introduced by coercionNAs introduced by coercionNAs introduced by coercionNAs introduced by coercionNAs introduced by coercionNAs introduced by coercionNAs introduced by coercionNAs introduced by coercionNAs introduced by coercionNAs introduced by coercionNAs introduced by coercionNAs introduced by coercionNAs introduced by coercionNAs introduced by coercionNAs introduced by coercionNAs introduced by coercionNAs introduced by coercionNAs introduced by coercionNAs introduced by coercionNAs introduced by coercionNAs introduced by coercionNAs introduced by coercionNAs introduced by coercionNAs introduced by coercionNAs introduced by coercionNAs introduced by coercionNAs introduced by coercionNAs introduced by coercionNAs introduced by coercionNAs introduced by coercionNAs introduced by coercionNAs introduced by coercionNAs introduced by coercionNAs introduced by coercionNAs introduced by coercionNAs introduced by coercionNAs introduced by coercionNAs introduced by coercionNAs introduced by coercionNAs introduced by coercionNAs introduced by coercionNAs introduced by coercionNAs introduced by coercionNAs introduced by coercionNAs introduced by coercionNAs introduced by coercionNAs introduced by coercionNAs introduced by coercionNAs introduced by coercionNAs introduced by coercionNAs introduced by coercionNAs introduced by coercionNAs introduced by coercionNAs introduced by coercionNAs introduced by coercionNAs introduced by coercionNAs introduced by coercionNAs introduced by coercionNAs introduced by coercionNAs introduced by coercionNAs introduced by coercionNAs introduced by coercionNAs introduced by coercionNAs introduced by coercionNAs introduced by coercionNAs introduced by coercionNAs introduced by coercionNAs introduced by coercionNAs introduced by coercionNAs introduced by coercion
return_all$name <- NULL
risk_all$name <- NULL
return_risk_all <- dplyr::left_join(x = return_all, y= risk_all, by= "Group.1")
names(return_risk_all)[names(return_risk_all)=="open.x"] <- "Mu"
names(return_risk_all)[names(return_risk_all)=="open.y"] <- "Sigma"
names(return_risk_all)[names(return_risk_all)=="Group.1"] <- "Name"
return_risk_all
return <- stats::aggregate(x = coin_hist_2019[,3:4], list(coin_hist_2019$name), mean)
argument is not numeric or logical: returning NAargument is not numeric or logical: returning NAargument is not numeric or logical: returning NAargument is not numeric or logical: returning NAargument is not numeric or logical: returning NAargument is not numeric or logical: returning NAargument is not numeric or logical: returning NAargument is not numeric or logical: returning NAargument is not numeric or logical: returning NAargument is not numeric or logical: returning NAargument is not numeric or logical: returning NAargument is not numeric or logical: returning NAargument is not numeric or logical: returning NAargument is not numeric or logical: returning NAargument is not numeric or logical: returning NAargument is not numeric or logical: returning NAargument is not numeric or logical: returning NAargument is not numeric or logical: returning NAargument is not numeric or logical: returning NAargument is not numeric or logical: returning NAargument is not numeric or logical: returning NAargument is not numeric or logical: returning NAargument is not numeric or logical: returning NAargument is not numeric or logical: returning NAargument is not numeric or logical: returning NAargument is not numeric or logical: returning NAargument is not numeric or logical: returning NAargument is not numeric or logical: returning NAargument is not numeric or logical: returning NAargument is not numeric or logical: returning NAargument is not numeric or logical: returning NAargument is not numeric or logical: returning NAargument is not numeric or logical: returning NAargument is not numeric or logical: returning NAargument is not numeric or logical: returning NAargument is not numeric or logical: returning NAargument is not numeric or logical: returning NAargument is not numeric or logical: returning NAargument is not numeric or logical: returning NAargument is not numeric or logical: returning NAargument is not numeric or logical: returning NAargument is not numeric or logical: returning NAargument is not numeric or logical: returning NAargument is not numeric or logical: returning NAargument is not numeric or logical: returning NAargument is not numeric or logical: returning NAargument is not numeric or logical: returning NAargument is not numeric or logical: returning NAargument is not numeric or logical: returning NAargument is not numeric or logical: returning NAargument is not numeric or logical: returning NAargument is not numeric or logical: returning NA
risk <- stats::aggregate(x = coin_hist_2019[,3:4], list(coin_hist_2019$name),sd)
NAs introduced by coercionNAs introduced by coercionNAs introduced by coercionNAs introduced by coercionNAs introduced by coercionNAs introduced by coercionNAs introduced by coercionNAs introduced by coercionNAs introduced by coercionNAs introduced by coercionNAs introduced by coercionNAs introduced by coercionNAs introduced by coercionNAs introduced by coercionNAs introduced by coercionNAs introduced by coercionNAs introduced by coercionNAs introduced by coercionNAs introduced by coercionNAs introduced by coercionNAs introduced by coercionNAs introduced by coercionNAs introduced by coercionNAs introduced by coercionNAs introduced by coercionNAs introduced by coercionNAs introduced by coercionNAs introduced by coercionNAs introduced by coercionNAs introduced by coercionNAs introduced by coercionNAs introduced by coercionNAs introduced by coercionNAs introduced by coercionNAs introduced by coercionNAs introduced by coercionNAs introduced by coercionNAs introduced by coercionNAs introduced by coercionNAs introduced by coercionNAs introduced by coercionNAs introduced by coercionNAs introduced by coercionNAs introduced by coercionNAs introduced by coercionNAs introduced by coercionNAs introduced by coercionNAs introduced by coercionNAs introduced by coercionNAs introduced by coercionNAs introduced by coercionNAs introduced by coercion
return$name <- NULL
risk$name <- NULL
return_risk <- dplyr::left_join(x = return, y= risk, by= "Group.1")
names(return_risk)[names(return_risk)=="open.x"] <- "Mu"
names(return_risk)[names(return_risk)=="open.y"] <- "Sigma"
names(return_risk)[names(return_risk)=="Group.1"] <- "Name"
return_risk
return_nd <- stats::aggregate(x = coin_hist_2018[,3:4], list(coin_hist_2018$name), mean)
argument is not numeric or logical: returning NAargument is not numeric or logical: returning NAargument is not numeric or logical: returning NAargument is not numeric or logical: returning NAargument is not numeric or logical: returning NAargument is not numeric or logical: returning NAargument is not numeric or logical: returning NAargument is not numeric or logical: returning NAargument is not numeric or logical: returning NAargument is not numeric or logical: returning NAargument is not numeric or logical: returning NAargument is not numeric or logical: returning NAargument is not numeric or logical: returning NAargument is not numeric or logical: returning NAargument is not numeric or logical: returning NAargument is not numeric or logical: returning NAargument is not numeric or logical: returning NAargument is not numeric or logical: returning NAargument is not numeric or logical: returning NAargument is not numeric or logical: returning NAargument is not numeric or logical: returning NAargument is not numeric or logical: returning NAargument is not numeric or logical: returning NAargument is not numeric or logical: returning NAargument is not numeric or logical: returning NAargument is not numeric or logical: returning NAargument is not numeric or logical: returning NAargument is not numeric or logical: returning NAargument is not numeric or logical: returning NAargument is not numeric or logical: returning NAargument is not numeric or logical: returning NAargument is not numeric or logical: returning NAargument is not numeric or logical: returning NAargument is not numeric or logical: returning NAargument is not numeric or logical: returning NAargument is not numeric or logical: returning NAargument is not numeric or logical: returning NAargument is not numeric or logical: returning NAargument is not numeric or logical: returning NAargument is not numeric or logical: returning NAargument is not numeric or logical: returning NAargument is not numeric or logical: returning NAargument is not numeric or logical: returning NAargument is not numeric or logical: returning NAargument is not numeric or logical: returning NAargument is not numeric or logical: returning NAargument is not numeric or logical: returning NAargument is not numeric or logical: returning NAargument is not numeric or logical: returning NAargument is not numeric or logical: returning NA
risk_nd <- stats::aggregate(x = coin_hist_2018[,3:4], list(coin_hist_2018$name),sd)
NAs introduced by coercionNAs introduced by coercionNAs introduced by coercionNAs introduced by coercionNAs introduced by coercionNAs introduced by coercionNAs introduced by coercionNAs introduced by coercionNAs introduced by coercionNAs introduced by coercionNAs introduced by coercionNAs introduced by coercionNAs introduced by coercionNAs introduced by coercionNAs introduced by coercionNAs introduced by coercionNAs introduced by coercionNAs introduced by coercionNAs introduced by coercionNAs introduced by coercionNAs introduced by coercionNAs introduced by coercionNAs introduced by coercionNAs introduced by coercionNAs introduced by coercionNAs introduced by coercionNAs introduced by coercionNAs introduced by coercionNAs introduced by coercionNAs introduced by coercionNAs introduced by coercionNAs introduced by coercionNAs introduced by coercionNAs introduced by coercionNAs introduced by coercionNAs introduced by coercionNAs introduced by coercionNAs introduced by coercionNAs introduced by coercionNAs introduced by coercionNAs introduced by coercionNAs introduced by coercionNAs introduced by coercionNAs introduced by coercionNAs introduced by coercionNAs introduced by coercionNAs introduced by coercionNAs introduced by coercionNAs introduced by coercionNAs introduced by coercion
return_nd$name <- NULL
risk_nd$name <- NULL
return_risk_nd <- dplyr::left_join(x = return_nd, y= risk_nd, by= "Group.1")
names(return_risk_nd)[names(return_risk_nd)=="open.x"] <- "Mu"
names(return_risk_nd)[names(return_risk_nd)=="open.y"] <- "Sigma"
names(return_risk_nd)[names(return_risk_nd)=="Group.1"] <- "Name"
return_risk_nd
ggplot(return_risk,aes(x=Sigma, y=Mu,label=Name)) + geom_point(alpha =0.6) + scale_x_log10() + scale_y_log10() + geom_text(aes(label=Name),hjust=0, vjust=0) + ggtitle("2019")

ggplot(return_risk_nd,aes(x=Sigma, y=Mu,label=Name)) + geom_point(alpha =0.6) + scale_x_log10() + scale_y_log10() + geom_text(aes(label=Name),hjust=0, vjust=0) + ggtitle("2018")

ggplot(return_risk_all, aes(x=Sigma, y=Mu, label = Name)) + geom_point(alpha = 0.6) + scale_x_log10() + scale_y_log10() + geom_text(aes(label = Name), hjust=0, vjust=0) + ggtitle("All")

ggplot(return_risk,aes(x=Sigma, y=Mu)) + geom_point(alpha =0.6) + scale_x_log10() + scale_y_log10()  + ggtitle("2019")
ggplot(return_risk_nd,aes(x=Sigma, y=Mu)) + geom_point(alpha =0.6) + scale_x_log10() + scale_y_log10() + ggtitle("2018")
ggplot(return_risk_all, aes(x=Sigma, y=Mu)) + geom_point(alpha = 0.6) + scale_x_log10() + scale_y_log10() + ggtitle("All")
# Prepare Data
data <- return_risk_all
data$Name <- as.character(data$Name)
data$Mu <- as.numeric(data$Mu)
data$Sigma <- as.numeric(data$Sigma)

plot1 <- data %>% 
    ggplot(aes(x = "All Coins", y = Mu)) + 
    geom_jitter(width = .025, height = 0, size = 2, alpha = .5, color = "blue") +
  labs(x = "", y="Return")
plot1


plot2 <- data %>% 
    ggplot(aes(x = "All Coins", y = Sigma)) + 
    geom_jitter(width = .025, height = 0, size = 2, alpha = .5, color = "red") +
  labs(x = "", y="Risk")
plot2

The charts above show us the distribution for each variable. Each point represents a crypto currency. (XXXX in total) As we see their is one crypto currency named as Bitcoin, which dominates all other crypto currencies. Therefore it might be good to exclude Bitcoin from our cluster finding procedure in order to clarify the picture more.

Each of the two variable has different behavior and we could identify groups of crypto currencies on each one individually, but that’s no the purpose here.

Both variables will be used in the clustering on a linear scale. Sometimes, when the values are in a big range, for example from -10 up to 4000, it is interesting to use a logarithmic scale because on a log scale we would highlight bigger differences between the values and smaller differences would be considered less important. Since the values in our dataset vary between 0 and 4100, we are going to use a linear scale, which considers differences between values equally important.

Clustering Reasons why we make use of the K-means algorithm for our research: “k-means clustering is a method of vector quantization, originally from signal processing, that aims to partition n observations into k clusters in which each observation belongs to the cluster with the nearest mean (cluster centers or cluster centroid), serving as a prototype of the cluster. This results in a partitioning of the data space into Voronoi cells. It is popular for cluster analysis in data mining. k-means clustering minimizes within-cluster variances (squared Euclidean distances), but not regular Euclidean distances, which would be the more difficult Weber problem: the mean optimizes squared errors, whereas only the geometric median minimizes Euclidean distances. For instance, better Euclidean solutions can be found using k-medians and k-medoids.”

The clustering algorithm that we are going to use is the K-means algorithm (), which we can find in the package stats. The K-means algorithm accepts two parameters as input:

The data; A K value, which is the number of groups that we want to create.

Conceptually, the K-means behaves as follows: 1. It chooses K centroids randomly; 2. Matches each point in the data (in our case, each crypto currency) with the closest centroid in an n-dimensional space where n is the number of features used in the clustering (in our example, 2 features – risk, return). After this step, each point belongs to a group. 3. Now, it recalculates the centroids as being the mean point (vector) of all other points in the group. 4. It keeps repeating the steps 2 and 3 until either when the groups are stabilized, that is, when no points are reallocated to another centroid or when it reaches the maximum number of iterations (the default number of iterations of the package stats is thereby ten)

Choosing a good K The bigger is the K you choose, the lower will be the variance within the groups in the clustering. If K is equal to the number of obervations, then each point will be a group and the variance will be 0. It is interesting to find a balance between the number of groups and their variance. A variance of a group means how different the members of the group are. The bigger is the dissimilarity in a group.

Now the question, “how do we choose the best value of K in order to find that balance?”, arises. Determining the number of clusters in a data set, is a frequent problem in data clustering and is a distinct issue from the process of actually solving the clustering problem. Therefore over time the academic world brouhgt up several methods in order to determine a good value for K.

The elobw method; X-means clustering; Information criterion approach; The silhouette method; Cross-validation; Finding number of clusters in text databases; Analyzing the kernel matrix (Sources must be added)

So, the academic world offers us several methods in order to identify our number of clusters. However, to answer that question, we are going to run K-means for an arbitrary K. Let’s pick three. Due to the fact, that the initial centroids are defined randomly, we define a seed for purposes of reproducibility.

# The nstart parameter indicates that we want the algorithm to be executed 20 times.
# This number is not the number of iterations, it is like calling the function 20 times and then
# the execution with lower variance within the groups will be selected as the final result.
kmeans(input, centers = 3, nstart = 20)
K-means clustering with 3 clusters of sizes 1, 74, 1

Cluster means:
       Mu    Sigma
1  288.14  149.310
2    1.63    2.115
3 4046.42 4107.480

Clustering vector:
 [1] 2 2 2 2 2 2 2 3 2 2 2 2 2 2 2 2 2 2 2 2 1 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2
[69] 2 2 2 2 2 2 2 2

Within cluster sum of squares by cluster:
[1]    0 9234    0
 (between_SS / total_SS = 100.0 %)

Available components:

[1] "cluster"      "centers"      "totss"        "withinss"     "tot.withinss" "betweenss"    "size"         "iter"         "ifault"      

The kmeans() function outputs the results of the clustering. We can see the centroid vectors (cluster means), the group in which each obervation was allocated (clustering vector) and a percentage (100 %) that represents the compactness of clustering, that is, how similar are the members within the same group. If all the observations within a group were in the same exact point in the n-dimensional space, then we would achieve 100 % of compactness, which is currently the case of our approach.

The function below plots a chart showing the “within sum of squares” (withinss) by the number of groups (K value) chosen for several executions of the algorithm. The within sum of squares is ametric that shows how dissimilar are the members of a group. The greater is the sum, the greater is the dissimilarity within a group.

# plots a chart showing the sum of squares within a group for each execution of the kmeans algorithm.
# In each execution the number of the initial groups increases by one up to the maximum number of centers passed as argument.
wssplot <- function(data, nc=15, seed=543){
  wss <- (nrow(data)-1)*sum(apply(data,2,var))
  for (i in 2:nc){
    set.seed(seed)
    wss[i] <- sum(kmeans(data, centers = i)$withinss)}
  plot(1:nc,wss,type="b", xlab="Number of groups", ylab = "Sum of squares within a group")}

wssplot(input, nc=20) #nc = is the parameter, which defines how many clusters should be tested

By analysing the chart from right to left, we can see that when the number of groups (K) reduces from 2 to 1 there is a big increase in the sum of squares, bigger than any other previous increase. That means that when it passes from 2 to 1 groups there is a reduction in the clustering compactness (by compactness, I mean the similarity within a group). Our goal, however, is not to achieve compactness of 100% - for that, we would just take each observation as a group. The main purpose is to find a fair number of groups that could explain satisfactorily a considerable part of the data.

So, let’s choose K=1 and run the K-means again

set.seed(543)
clustering <- kmeans(input, centers = 1, nstart = 20)
clustering
K-means clustering with 1 clusters of sizes 76

Cluster means:
     Mu Sigma
1 58.62 58.07

Clustering vector:
 [1] 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
[43] 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1

Within cluster sum of squares by cluster:
[1] 32842543
 (between_SS / total_SS =  -0.0 %)

Available components:

[1] "cluster"      "centers"      "totss"        "withinss"     "tot.withinss"
[6] "betweenss"    "size"         "iter"         "ifault"      

Using 1 group (K=1) we had -0% of well-grouped data. Using X groups (K=X) that value raised to XX.X%, which is a good value for us.

Clustering Validation We may use the silhouette coefficient (silhouette width) to evaluate the goodness of our clustering.

The silhouette coefficient is calculated as follows: 1. For each observation i, it calculates the average dissimilarity between i and all the other points within the same cluster which i belongs. Let’s call this average dissimilarity “Di”. 2. Now we do the same dissimilarity calculation between i and all the other clusters and get the lowest value among them. That, is we find the dissimilarity between i and the cluster that is closet to i right after its own cluster. Let’s call that value “’Ci” 3. The silhouette (Si) width is the difference between Ci and Di (Ci-Di) divided by the greatest of those two values (max(Di,Gi)). Si = (Ci-Di) / max(Di,Gi)

So, the interpretation of the silhouette width is the following: Si > 0 means that the observation is well clustered. The closet it is to 1, the best it is clustered. Si < 0 means that the observation was placed in the wrong cluster. Si = 0 means that the observation is between two clusters.

The silhouette plot below gives us evidence that our clustering using four groups is good because there is no negative silhouette width and most of the values are bigger than 0.5.

library(cluster)
install.packages(factoextra)
Error in install.packages : object 'factoextra' not found
library(factoextra)
sil <- silhouette(clustering$cluster, dist(input))
factoextra::fviz_silhouette(sil)
Error in factoextra::fviz_silhouette(sil) : 
  Don't support an oject of class logical

Clustering interpretation The following plot shows the final result of our clustering. The actual plot is interactive, but the image below is not. In the interactive plot, you may isolate the groups to better understand each one individually.

library(GGally)
library(plotly)

return_risk_all$cluster <- as.factor(clustering$cluster)
p <- ggparcoord(data = return_risk_all, columns = c(2:3), groupColumn = "cluster",  scale = "std") + labs(x = "CC's", y = "Value in sd", title = "Clustering")
ggplotly(p)

The purpose of clustering analysis is to identify patterns in the data. As we can see in the plot above, obervations within the same group tend to have similar characteristics.

LS0tCnRpdGxlOiAiQ3J5cHRvX0FuYWx5c2lzIgpvdXRwdXQ6IGh0bWxfbm90ZWJvb2sKQXV0aG9yOiBLw7ZmZmVsIEZhYmlhbiwgQW1hbm4gTWF0dGhpYXMKLS0tCmBgYHtyIGxvYWQgcGFja2FnZSBjcnlwdG8yfQpkZXZ0b29sczo6aW5zdGFsbF9naXRodWIoImplc3NldmVudC9jcnlwdG8iLCBmb3JjZT0gVFJVRSkKcGFjbWFuOj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